package com.xoa.controller.workflow;

import com.xoa.model.users.Users;
import com.xoa.service.syspara.SysParaService;
import com.xoa.util.CookiesUtil;
import com.xoa.util.common.session.SessionUtils;
import com.xoa.util.dataSource.ContextHolder;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.annotation.Resource;
import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletRequest;

/**
 * Created by 韩东堂 on 2017/5/20.
 */
@Controller
@RequestMapping("/flowSetting")
public class FlowSettingPageController {

    @Resource
    SysParaService sysParaService;


    @RequestMapping("/index")
    public String indexPage(Model model,Integer flowId,HttpServletRequest request){
        Cookie redisSessionCookie = CookiesUtil.getCookieByName(request, "redisSessionId");
        String loginDateSouse = SessionUtils.getSessionInfo(request.getSession(), "loginDateSouse", String.class, redisSessionCookie);
        ContextHolder.setConsumerType("xoa" + loginDateSouse);
        //System.out.println("页面获取参数："+flowId);
        model.addAttribute("flowId",flowId);
        return "app/workflow/flowsettting/index";
    }
    @RequestMapping("/processDesignTool")
    public String processDesignToolpage(){
        return "app/workflow/flowsettting/processDesignTool";
    }

    @RequestMapping("/processDesignliucheng")
    public String processDesignliucheng(){
        return "app/workflow/flowsettting/processDesignliucheng";
    }

    @RequestMapping("/processDesignToolTwo")
    public String processDesignToolTwopage(){
        return "app/workflow/flowsettting/processDesignToolTwo";
    }

    @RequestMapping("/processDesignToolTwoO")
    public String processDesignToolTwopageO(){
        return "app/workflow/flowsettting/processDesignToolTwoO";
    }

    @RequestMapping("/processDesignToolTwoT")
    public String processDesignToolTwopageT(){
        return "app/workflow/flowsettting/processDesignToolTwoT";
    }



    @RequestMapping("/processDesignToolTwoThelog")
    public String processDesignToolTwoThelog(){
        return "app/workflow/flowsettting/processDesignToolTwoThelog";
    }



    @RequestMapping("/processDesignToolTwoView")
    public String processDesignToolTwoView(){
        return "app/workflow/flowsettting/processDesignToolTwoView";
    }
    @RequestMapping("/processDesignToolsT")
    public String processDesignToolsT(){
        return "app/workflow/flowsettting/processDesignToolsT";
    }

    @RequestMapping("/processDesignToolsTlc")
    public String processDesignToolsTlc(){
        return "app/workflow/flowsettting/processDesignToolsTliucheng";
    }

    @RequestMapping("/flowSettingMain")//首页
    public String flowSettingMain(){
        return "app/workflow/flowsettting/theDesignProcess/main";
    }
    @RequestMapping("/theHomePage")//主页
    public String theHomePage(){
        return "app/workflow/flowsettting/theDesignProcess/theHomePage";
    }
    @RequestMapping("/attributeTwo")//属性
    public String attributeTwo(){
        return "app/workflow/flowsettting/theDesignProcess/designProcessSection/attribute";
    }
    @RequestMapping("/stepsTwo")//步骤
    public String stepsTwo(){
        return "app/workflow/flowsettting/theDesignProcess/designProcessSection/steps";
    }
    @RequestMapping("/permissions")//权限
    public String permissions(HttpServletRequest request){
        Cookie redisSessionCookie = CookiesUtil.getCookieByName(request, "redisSessionId");
        Users user= SessionUtils.getSessionInfo(request.getSession(), Users.class, new Users(),redisSessionCookie);
        if (!sysParaService.checkIsHaveSecure(user,8)){
            return "app/common/development";
        }
        return "app/workflow/flowsettting/theDesignProcess/permissions";
    }
    @RequestMapping("/timingTask")//定时任务
    public String timingTask(){
        return "app/workflow/flowsettting/theDesignProcess/timingTask";
    }
    @RequestMapping("/configureTemplateQuery")//配置模板查询
    public String configureTemplateQuery(){
        return "app/workflow/flowsettting/theDesignProcess/configureTemplateQuery";
    }
    @RequestMapping("/applicationLayoutFile")//应用版式文件
    public String applicationLayoutFile(){
        return "app/workflow/flowsettting/theDesignProcess/applicationLayoutFile";
    }
    @RequestMapping("/attributeThree")//属性
    public String attributeThree(){
        return "app/workflow/flowsettting/theDesignProcess/designProcessSection/attributeTwo";
    }

    @RequestMapping("/addFlowMenu")
    public String addFlowMenu(){
        return "app/workflow/flowsettting/theDesignProcess/addFlowMenu";
    }
}
